const loopTreeContractType = (treeList: Record<string, any>[]): any[] => {
  const handleTree = (dataList: Record<string, any>[]) => {
    dataList?.forEach((item: any, index: number) => {
      if (item?.children && item?.children?.length > 0) {
        handleTree(item?.children);
      }
      dataList[index] = {
        name: item?.name,
        value: item?.id,
        disabled: item?.children?.length > 0 ? true : false,
        children: item?.children,
      };
    });
    return dataList;
  };

  const treeData: any = handleTree(treeList);
  return treeData;
};

export { loopTreeContractType };
